package com.example.lx5_27.fg

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.launcher.ARouter
import com.blankj.utilcode.util.ToastUtils
import com.example.base.entity.NoticeBeanItem
import com.example.base.mvvm.BaseFragment
import com.example.lx5_27.R
import com.example.lx5_27.adapter.NoticeAdapter
import com.example.lx5_27.databinding.FragmentHomeBinding
import com.example.park2301a.notice.NoticeViewModel
import kotlinx.coroutines.launch


class HomeFragment : BaseFragment<FragmentHomeBinding, NoticeViewModel>() {

    val noticeAdapter by lazy { NoticeAdapter() }

    override fun initView() {
        binding.rv.apply {
            adapter = noticeAdapter
            layoutManager = LinearLayoutManager(requireContext())
        }
        lifecycleScope.launch {
            vm.getNotices().collect{
                noticeAdapter.submitData(it)
            }
        }
        binding.servicePark.setOnClickListener {
            ARouter.getInstance().build("/app/VisitActivity").navigation()
        }
    }

    override fun initData() {

    }

}